package pl.edu.pk.mech.kkbus.controller;

import java.util.List;
import java.util.logging.Logger;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import pl.edu.pk.mech.kkbus.dto.Log;
import pl.edu.pk.mech.kkbus.service.HistoryLogService;

@Controller
public class HistoryController extends RestController {

    private static final Logger log = Logger.getLogger(HistoryController.class.getName());
    
    @Autowired
    HistoryLogService historyLogService;
    
    @RequestMapping(value = "/history/user/{id}", method = RequestMethod.GET)
    public @ResponseBody List<Log> getHistory(@PathVariable long id) {
        log.info("Get history log for user " + id);
        return historyLogService.getHistoryLogForUser(id);
    }
    
}
